"""数据表"""

from sqlalchemy import Column, String, Integer, DateTime
from db import create_db

db = create_db()


class User(db.Models):
    """用户表"""
    __tablename__ = 'T_Register_Main'
    cClientCode = Column(String(20), primary_key=True)
    cCardNo = Column(String(100), comment='体检卡号')
    cName = Column(String(1000), comment='姓名')
    cSex = Column(Integer, comment='性别')
    dBornDate = Column(DateTime, comment='出生日期')
    iAges = Column(Integer, comment='年龄')
    cIdCard = Column(String(50), comment='身份证号码')
    dAffirmdate = Column(DateTime, comment='体检日期')
    cAddress = Column(String(500), comment='PDF路径')

    def __repr__(self):
        return f'<User {self.cName}>'


class Info(db.Models):
    __tablename__ = 'T_Check_result_Main'
    cClientCode = Column(String(20), comment='内部编码')
    cDeptCode = Column(String(50), comment='科室编码')
    cMainCode = Column(String(200), comment='科室名称')
    cResultCure = Column(String(200), comment='科室小结')
    cDoctName = Column(String(200), comment='医生姓名')
    dOperDate = Column(DateTime, comment='检查日期')
    cIllnessGrade = Column(String(30), comment='是否异常')  # 正常  异常

    def __repr__(self):
        return f'<Info {self.cDeptCode}>'
